<template>
    <!-- 模板素材Main -->
    <div>
        <van-nav-bar fixed title="模板素材" left-text="返回" left-arrow @click-left="goBack"/>
        <!-- 上边框 -->
        <van-tabs sticky :offset-top="45" v-model="active" animated color="#409EFF" @click="link">
            <van-tab :title="van.title" v-for="(van, i) in vans" :key="i">
                <router-view/>
            </van-tab>
        </van-tabs>
    </div>
</template>
<script>
export default {
    data() {
        return {
            active: 0,
            vans: [
                { title: '基础模板', to: '/sourceMaterial/baseTemp' },
                { title: '功能组件', to: '/sourceMaterial/readyTemp' },
                { title: '素材中心', to: '/sourceMaterial/sourceCenter' }
            ]
        }
    },
    methods: {
        goBack(){
            this.$router.go(-1);
        },
        link() {
            this.$router.replace(this.vans[this.active].to)
        }
    }
}
</script>